package com.xbongbong.paas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * 阶段推进器-阶段变更触发枚举
 * @author 李少杰
 * @version v1.0.0
 * @date 2021/12/28 11:29
 */
@Getter
public enum StageChangeTypeEnum {
    /**
     * 阶段流程及阶段变更
     */
    STAGE_PROCESS_CHANGE(1, "enum.stageChangeType.describe.stage_process_change"),
    /**
     * 阶段变更
     */
    STAGE_CHANGE(2, "enum.stageChangeType.describe.stage_change"),
    /**
     * 阶段任务变更
     */
    STAGE_WORK_CHANGE(3, "enum.stageChangeType.describe.stage_work_change"),
    /**
     * 阶段任务删除
     */
    STAGE_WORK_DELETE(4, "enum.stageChangeType.describe.stage_work_delete"),
    /**
     * 阶段任务排序
     */
    STAGE_WORK_SORT(5, "enum.stageChangeType.describe.stage_work_sort"),
    /**
     * 开始阶段变更
     */
    STAGE_START_CHANGE(6, "enum.stageChangeType.describe.start_stage_change"),

    ;

    StageChangeTypeEnum(Integer type, String describe){
        this.type = type;
        this.describe = describe;
    }

    /**
     * 变更类型
     */
    private final Integer type;
    /**
     * 描述
     */
    private final String describe;


    public static StageChangeTypeEnum getByType(Integer type) {
        for (StageChangeTypeEnum stageChangeTypeEnum : values()) {
            if (Objects.equals(stageChangeTypeEnum.getType(), type)) {
                return stageChangeTypeEnum;
            }
        }
        return null;
    }
}
